/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * frmMain.java
 *
 * Created on Aug 21, 2012, 12:50:17 PM
 */
package gui;

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Toolkit;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import pojo.*;

/**
 *
 * @author dtth
 */
public class frmMain extends javax.swing.JFrame {

    JLabel jlblStatusBar = new JLabel();
    private static Khosanpham pojoKhoSanPham = new Khosanpham();
    private static Cuahang pojoCuaHang = new Cuahang();
    private static Nhanvien pojoNhanVien = new Nhanvien();
//    private static Khosanpham pojoKhoSanPham = null;
//    private static Cuahang pojoCuaHang = null;
//    private static Nhanvien pojoNhanVien = null;
    /** Creates new form frmMain */
    public void setInfor_Temp() {
        pojoKhoSanPham.setMakhosanpham(4);
        pojoKhoSanPham.setSoluongton(100);
        
        pojoCuaHang.setMacuahang(1);
        pojoCuaHang.setChucuahang("Ông A");
        pojoCuaHang.setDiachi("Quận Bình Thạnh");
        pojoCuaHang.setTencuahang("Simanchao");
        
        pojoNhanVien = new Nhanvien(1, "Lâm Văn Sơn");
    }
    public static void setInformations(Nhanvien prNV, Cuahang prCH, Khosanpham prKSP) {
        pojoNhanVien = prNV;
        pojoCuaHang = prCH;
        pojoKhoSanPham = prKSP;
    }
    
    public frmMain() {
        setInfor_Temp();
        initComponents();
        
        Toolkit tk = Toolkit.getDefaultToolkit();
        Dimension di = tk.getScreenSize();
        this.setLocation(di.width/4, di.height/4);
        
        this.setSize(650, 450);
         
        jlblStatusBar.setText("Nhân viên lập phiếu: " + pojoNhanVien.getTennhanvien());
        jlblStatusBar.setFont(new java.awt.Font("Tahoma", 1, 14));
        add(jlblStatusBar, BorderLayout.SOUTH);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        jMenuBar1 = new javax.swing.JMenuBar();
        jMenu1 = new javax.swing.JMenu();
        jmnuQLHoaDon = new javax.swing.JMenuItem();
        jmnuQLPhieuNhap = new javax.swing.JMenuItem();
        jmnuTimKiem = new javax.swing.JMenuItem();
        jmnuThongKe = new javax.swing.JMenu();
        jmnuDoanhThu = new javax.swing.JMenuItem();
        jmnuTonKho = new javax.swing.JMenuItem();
        jmnuTimKiemPhieuNhap = new javax.swing.JMenuItem();
        jmnuLapHoaDon = new javax.swing.JMenu();
        jmnuNhapSanPham = new javax.swing.JMenu();
        jMenu2 = new javax.swing.JMenu();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Quản Lý Chuỗi Cửa Hàng Tạp Hóa");

        jPanel1.setPreferredSize(new java.awt.Dimension(650, 450));
        jPanel1.setLayout(null);
        getContentPane().add(jPanel1, java.awt.BorderLayout.CENTER);

        jMenuBar1.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N

        jMenu1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/gui/images/Ribbon_Save_32x32.png"))); // NOI18N
        jMenu1.setText("Quản Lý");
        jMenu1.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jMenu1.setPreferredSize(new java.awt.Dimension(110, 35));

        jmnuQLHoaDon.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jmnuQLHoaDon.setIcon(new javax.swing.ImageIcon(getClass().getResource("/gui/images/Ribbon_Save_32x32.png"))); // NOI18N
        jmnuQLHoaDon.setText("Hóa Đơn");
        jmnuQLHoaDon.setPreferredSize(new java.awt.Dimension(180, 35));
        jMenu1.add(jmnuQLHoaDon);

        jmnuQLPhieuNhap.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jmnuQLPhieuNhap.setIcon(new javax.swing.ImageIcon(getClass().getResource("/gui/images/Ribbon_Content_32x32.png"))); // NOI18N
        jmnuQLPhieuNhap.setText("Phiếu Nhập");
        jmnuQLPhieuNhap.setPreferredSize(new java.awt.Dimension(113, 35));
        jmnuQLPhieuNhap.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jmnuQLPhieuNhapActionPerformed(evt);
            }
        });
        jMenu1.add(jmnuQLPhieuNhap);

        jmnuTimKiem.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jmnuTimKiem.setIcon(new javax.swing.ImageIcon(getClass().getResource("/gui/images/Ribbon_Find_32x32.png"))); // NOI18N
        jmnuTimKiem.setText("Tìm Kiếm Hóa Đơn");
        jmnuTimKiem.setPreferredSize(new java.awt.Dimension(113, 35));
        jmnuTimKiem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jmnuTimKiemActionPerformed(evt);
            }
        });
        jMenu1.add(jmnuTimKiem);

        jmnuThongKe.setIcon(new javax.swing.ImageIcon(getClass().getResource("/gui/images/Ribbon_New_32x32.png"))); // NOI18N
        jmnuThongKe.setText("Thống Kê");
        jmnuThongKe.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jmnuThongKe.setPreferredSize(new java.awt.Dimension(117, 35));

        jmnuDoanhThu.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jmnuDoanhThu.setIcon(new javax.swing.ImageIcon(getClass().getResource("/gui/images/Ribbon_Close_32x32.png"))); // NOI18N
        jmnuDoanhThu.setText("Doanh Thu");
        jmnuDoanhThu.setPreferredSize(new java.awt.Dimension(170, 35));
        jmnuThongKe.add(jmnuDoanhThu);

        jmnuTonKho.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jmnuTonKho.setIcon(new javax.swing.ImageIcon(getClass().getResource("/gui/images/Ribbon_Open_32x32.png"))); // NOI18N
        jmnuTonKho.setText("Tồn Kho");
        jmnuTonKho.setPreferredSize(new java.awt.Dimension(113, 35));
        jmnuThongKe.add(jmnuTonKho);

        jMenu1.add(jmnuThongKe);

        jmnuTimKiemPhieuNhap.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jmnuTimKiemPhieuNhap.setIcon(new javax.swing.ImageIcon(getClass().getResource("/gui/images/Ribbon_Find_32x32.png"))); // NOI18N
        jmnuTimKiemPhieuNhap.setText("Tìm Kiếm Phiếu Nhập");
        jmnuTimKiemPhieuNhap.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jmnuTimKiemPhieuNhapActionPerformed(evt);
            }
        });
        jMenu1.add(jmnuTimKiemPhieuNhap);

        jMenuBar1.add(jMenu1);

        jmnuLapHoaDon.setIcon(new javax.swing.ImageIcon(getClass().getResource("/gui/images/hoadon_32.png"))); // NOI18N
        jmnuLapHoaDon.setText("Lập Hóa Đơn");
        jmnuLapHoaDon.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jmnuLapHoaDon.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jmnuLapHoaDonMouseClicked(evt);
            }
        });
        jMenuBar1.add(jmnuLapHoaDon);

        jmnuNhapSanPham.setIcon(new javax.swing.ImageIcon(getClass().getResource("/gui/images/feeds_blue_32.png"))); // NOI18N
        jmnuNhapSanPham.setText("Nhập Sản Phẩm");
        jmnuNhapSanPham.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jmnuNhapSanPham.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jmnuNhapSanPhamMouseClicked(evt);
            }
        });
        jMenuBar1.add(jmnuNhapSanPham);

        jMenu2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/gui/images/Ribbon_Exit_32x32.png"))); // NOI18N
        jMenu2.setText("Thoát");
        jMenu2.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jMenu2.setPreferredSize(new java.awt.Dimension(90, 19));
        jMenu2.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jMenu2MouseClicked(evt);
            }
        });
        jMenu2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenu2ActionPerformed(evt);
            }
        });
        jMenuBar1.add(jMenu2);

        setJMenuBar(jMenuBar1);

        pack();
    }// </editor-fold>//GEN-END:initComponents

private void jMenu2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenu2ActionPerformed
    // TODO add your handling code here:
}//GEN-LAST:event_jMenu2ActionPerformed

private void jMenu2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jMenu2MouseClicked
// TODO add your handling code here:
    System.exit(0);
}//GEN-LAST:event_jMenu2MouseClicked

private void jmnuLapHoaDonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jmnuLapHoaDonMouseClicked
// TODO add your handling code here:
    frmLapHoaDon lhd = new frmLapHoaDon();
    lhd.setVisible(true);
}//GEN-LAST:event_jmnuLapHoaDonMouseClicked

private void jmnuNhapSanPhamMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jmnuNhapSanPhamMouseClicked
// TODO add your handling code here:
    frmNhapSanPham nhap = new frmNhapSanPham();
    frmNhapSanPham.setInformations(pojoNhanVien, pojoCuaHang, pojoKhoSanPham);
    nhap.setVisible(true);
}//GEN-LAST:event_jmnuNhapSanPhamMouseClicked

    private void jmnuTimKiemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmnuTimKiemActionPerformed
        // TODO add your handling code here:
        
    }//GEN-LAST:event_jmnuTimKiemActionPerformed

    private void jmnuQLPhieuNhapActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmnuQLPhieuNhapActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jmnuQLPhieuNhapActionPerformed

    private void jmnuTimKiemPhieuNhapActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmnuTimKiemPhieuNhapActionPerformed
        // TODO add your handling code here:
        frmTimKiemPhieuNhap frm = new frmTimKiemPhieuNhap();
        frm.setVisible(true);
    }//GEN-LAST:event_jmnuTimKiemPhieuNhapActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(frmMain.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(frmMain.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(frmMain.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(frmMain.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new frmMain().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenu jMenu2;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JMenuItem jmnuDoanhThu;
    private javax.swing.JMenu jmnuLapHoaDon;
    private javax.swing.JMenu jmnuNhapSanPham;
    private javax.swing.JMenuItem jmnuQLHoaDon;
    private javax.swing.JMenuItem jmnuQLPhieuNhap;
    private javax.swing.JMenu jmnuThongKe;
    private javax.swing.JMenuItem jmnuTimKiem;
    private javax.swing.JMenuItem jmnuTimKiemPhieuNhap;
    private javax.swing.JMenuItem jmnuTonKho;
    // End of variables declaration//GEN-END:variables
}
